import store from '@/store/index.js'
const BASEURL = 'http://kumanxuan1.f3322.net:8001'
export function fetch(url,data={},headers={},method="POST"){
	return new Promise((resolve,reject)=>{
		// console.log('token:' + store.state.mytolen);
		headers["x-nideshop-token"]=store.state.mytolen
		// headers['content-type']='application/json; charset=utf-8'
		uni.request({
			url:BASEURL + url,
			data:data,
			header:headers,
			method:method,
			// responseType:"json",
			dataType:"json",
			success(res){
					resolve(res.data)
			},
			fail(){
				reject(null)
			}
		})
	})
}